package com.xinruke.hostels.common.vo;

import java.util.Comparator;

/**
 * @Author: chenry
 * @Date: 2018/5/9 10:27
 * @Description: 权重数据实体Vo
 */
public class WeightCategory {
    private String category;
    private int weight;


    public WeightCategory() {
        super();
    }

    public WeightCategory(String category, Integer weight) {
        super();
        this.setCategory(category);
        this.setWeight(weight);
    }


    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public int getWeight() {
        return weight;
    }

    public void setWeight(int weight) {
        this.weight = weight;
    }


    /**
     * 权重数据比较器
     */
    public class AESComparator implements Comparator<WeightCategory> {

        public int compare(WeightCategory o1, WeightCategory o2) {
            return (Integer.parseInt(o1.getCategory()) - Integer.parseInt(o2.getCategory())) > 0 ? 1 : -1;
        }
    }
}